package spark.graphics;

import org.xml.sax.helpers.DefaultHandler;
import org.xml.sax.SAXException;
import org.xml.sax.Attributes;

import java.util.HashMap;
import java.util.Map;
import java.util.LinkedList;

class SpriteMapThemeFetcher extends DefaultHandler {
	class FinishedProcessing extends SAXException {
	}
	
	private LinkedList<String> themes = new LinkedList<String>();

	@Override
	public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
		if(localName.equals(SpriteMapParser.ELE_THEME)) {
			themes.add(attributes.getValue(SpriteMapParser.ATT_NAME));
		}
		else if(localName.equals(SpriteMapParser.ELE_SPRITE)) {
			throw new FinishedProcessing();
		}
	}

	public LinkedList<String> getThemes() {
		return themes;
	}
}